package dice.sinanya.dice.manager;

import dice.sinanya.entity.EntityTypeMessages;

import static dice.sinanya.system.MessagesSystem.NONE;
import static dice.sinanya.system.MessagesTag.TAG_ST_NAME;
import static dice.sinanya.tools.getinfo.GetName.getRandomName;
import static dice.sinanya.tools.makedata.MakeMessages.deleteTag;

/**
 * @author SitaNya
 * @date 2019/11/25
 * @email sitanya@qq.com
 * @qqGroup 162279609
 * 有任何问题欢迎咨询
 * <p>
 * 类说明:
 */
public class Name {
    private final EntityTypeMessages entityTypeMessages;

    public Name(EntityTypeMessages entityTypeMessages) {
        this.entityTypeMessages = entityTypeMessages;
    }

    public void nn() {
        String tag = TAG_ST_NAME;
        String msg = deleteTag(entityTypeMessages.getMsgGet().getMsg(), tag.substring(0, tag.length() - 2));
        if (msg.equals(NONE)) {
            entityTypeMessages.getMsgGet().setMsg(".st" + getRandomName());
            new Roles(entityTypeMessages).set();
        } else {
            entityTypeMessages.getMsgGet().setMsg(".st" + msg);
            new Roles(entityTypeMessages).set();
        }
    }
}
